<?php
/* Connect to an ODBC database using driver invocation */
$dsn = 'mysql:dbname=test;host=127.0.0.1';
$user = 'root';
$password = 'th';

try {
    $dbh = new PDO($dsn, $user, $password);
	$sql = 'SELECT * from `user`';
	$stmt = $dbh->prepare($sql);
	$stmt->execute();
	$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
	echo json_encode($result);
} catch (Exception $e) {
    	echo 'Connection failed: ' . $e->getMessage();
}

